package cn.wolfcode.common.utils;

import cn.wolfcode.common.exception.BusinessException;
import cn.wolfcode.common.web.CodeMsg;

/**
 * @author zh
 * @date 2025/9/15 20:49
 * @description:自定义断言，用于判断
 */
public class AsserUtil {

    public static final int SUCCESS_CODE = 200;
    public static final int FAIL_CODE = 201;

    public static void isNull(Object obj, String msg) {
        if (obj == null) {
            throw new BusinessException(new CodeMsg(FAIL_CODE, msg));
        }
    }
    public static void notNull(Object obj, String msg) {
        if (obj != null) {
            throw new BusinessException(new CodeMsg(FAIL_CODE, msg));
        }
    }


    public static void isTrue(boolean bolTrue, String msg) {
        if (bolTrue) {
            throw new BusinessException(new CodeMsg(FAIL_CODE, msg));
        }
    }
    public static void notTrue(boolean bolFalse, String msg) {
        if (!bolFalse) {
            throw new BusinessException(new CodeMsg(FAIL_CODE, msg));
        }
    }



}
